import type { Imports } from "types/import";
import type { ComponentResolver } from "unplugin-vue-components/types";

export const dirs: string[] = [
  "src/layout/components/n-menu",
  "src/layout/components/n-main",
  "src/layout/components/n-header",
];

export const imports: Imports = {
  vue: [],
  "naive-ui": [
    "darkTheme",
    "lightTheme",
    "useThemeVars",
    "useModal",
    "useDialog",
    "useMessage",
    "useLoadingBar",
    "useNotification",
    "createDiscreteApi",
  ],
  "lodash-es": ["get", "set", "unset", "sortBy", "isArray", "capitalize"],
  "vue-router": ["createRouter", "createWebHistory"],
  "@/enums": ["Store"],
  "@/utils": [
    "createAxios",
    "setDomTitle",
    "getNaiveLocale",
    "getNaiveDateLocale",
  ],
  "@/stores": ["setupStore", "useAppStore", "useSettingStore"],
  "@/router": ["router", "menuRoutes", "setupRouter"],
  "@/layout": ["useLayout", "setupLayout"],
  "@/setting": ["LOGO", "TITLE", "API_URL", "BASE_PATH"],
  "@/composables": ["useApp", "useRequest"],
};

export const resolver: ComponentResolver[] = [
  {
    type: "component",
    resolve(name: string) {
      if (name.startsWith("Use")) {
        return {
          name,
          from: "@vueuse/components",
        };
      }
    },
  },
];
